package com.huwaiwai.fork_join.demo03;

import java.util.concurrent.Semaphore;

/**
 * Created by huweiwei on 2017/4/18.
 */
public class Test {
    @org.junit.Test
    public void test01() throws InterruptedException {
        Semaphore sem = new Semaphore(10);

        for (int i = 0; i < 20; i++) {
            System.out.println("获取两个信号");
            sem.acquire();
            sem.acquire();
            System.out.println("释放一个信号");
            sem.release();
        }



    }
}
